<?php

Raise::load('core.RaiseStaticClass');

/**
 * RaisePhpExtension helper class
 * PHP extension / add-on module related functionalities
 *
 * @author Sam-Mauris Yong / hellclanner at live dot com
 * @license http://www.opensource.org/licenses/bsd-license New BSD License
 * @package phpraise.core
 * @since 1.2
 */
class RaisePhpExtension extends RaiseStaticClass {

    /**
     * Dynamically load a PHP built-in or dynamically loaded extension
     * @static
     * @param string $ext Name of extension to load.
     * @link http://www.php.net/dl
     * @return bool True if successfully loaded, false otherwise.
     */
    public static function load($ext) {
        return dl($ext);
    }

    /**
     * Check if a particular extension has been loaded.
     * @static
     * @param string $ext
     * @link http://www.php.net/extension-loaded
     * @return bool
     */
    public static function isLoaded($ext) {
        return extension_loaded($ext);
    }

    /**
     * Get an array of loaded extensions
     * @static
     * @param bool $zend (optional) Return zend extensions in the array or not.
     * @return array An indexed array of all module names that are loaded
     * @link http://www.php.net/get-loaded-extensions
     */
    public static function loaded($zend = false) {
        return get_loaded_extensions($zend);
    }

    /**
     * Get all functions defined by a particular module / extension
     * @static
     * @param string $ext Module / extension to fetch from
     * @return array
     * @link http://www.php.net/get-extension-funcs
     */
    public static function functions($ext) {
        return get_extension_func($ext);
    }

}

